﻿namespace Sidvall.WorkItemManager.Data.Entity.Model
{
    public class ResourceFactory : global::Sidvall.Data.IResourceFactory
    {
        #region Public Members

        #region CreateItem

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public object CreateItem(string resource, Sidvall.Data.DataRowState? dataRowState)
        {
            switch (resource)
            {
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkCondition:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkCondition(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.Worker:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.Worker(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItem:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItem(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemLog:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemLog(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemSensor:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemSensor(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemSensorLog:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemSensorLog(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemType:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemType(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemWorkCondition:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemWorkCondition(false, null, dataRowState);
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkRetryPolicy:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkRetryPolicy(false, null, dataRowState);
                default:
                    return null;
            }
        }
        
        #endregion
        #region CreateItems
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public object CreateItems(string resource)
        {
            switch (resource)
            {
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkCondition:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkConditionCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.Worker:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkerCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItem:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemLog:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemLogCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemSensor:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemSensorCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemSensorLog:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemSensorLogCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemType:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemTypeCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkItemWorkCondition:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemWorkConditionCollection();
                case global::Sidvall.WorkItemManager.Data.Model.DomainObjects.WorkRetryPolicy:
                    return new global::Sidvall.WorkItemManager.Data.Entity.Entities.WorkRetryPolicyCollection();
                default:
                    return null;
            }
        }
        
        #endregion

        #region Current

        private static readonly System.Lazy<ResourceFactory> _Current = new System.Lazy<ResourceFactory>(() => new ResourceFactory());
        public static ResourceFactory Current
        {
            get
            {
                return _Current.Value;
            }
        }

        #endregion

        #endregion
    }
}